package com.kly.constants;

/**
 * @author admin
 * @date 2025/3/16
 */
public interface RedisConstant {

    String PICTURE_LIKE_KEY = "picture:like:";

    String USER_FOLLOW_KEY = "user:follow:";

    String PICTURE_FEED_KEY = "picture:feed:";

    String USER_SIGN_KEY = "user:sign";


    /**
     * 过期时间
     */
    Integer ONE_TIME_TTL = 1;

    /**
     * 缓存过期时间
     */
    Integer TEN_TIME_TTL = 10;

    /**
     * 图片访问量key 过期时间
     */
    Integer THIRTY_TIME_TTL_LONG = 30;

    /**
     * 图片访问量key
     */
    String PICTURE_VISIT_COUNT_KEY = "picture:visit:count";
    /**
     * 空间访问量key
     */
    String SPACE_VISIT_COUNT_KEY = "space:visit:count";

    /**
     * 图片评论点赞key
     */
    String PICTURE_COMMENT_LIKE_KEY = "picture:comment:like:";


    /**
     * 用户登录验证码key
     */
    String USER_LOGIN_CODE_KEY = "user:login:code:";

    /**
     * 用户登录邮箱验证码key
     */
    String USER_LOGIN_CODE_EMAIL_KEY = "user:login:code:email:";

    /**
     * 用户登录验证码key 过期时间
     */
    Integer USER_LOGIN_CODE_EMAIL_TTL = 5;

    /**
     * 用户登录验证码key 过期时间
     */
    Integer USER_LOGIN_CODE_TTL = 2;

    /**
     * 用户登录信息key
     */
    String USER_LOGIN_INFO_KEY = "user:login:info:";

    /**
     * 用户登录信息key 过期时间 1天
     */
    Long USER_LOGIN_INFO_TTL = 86400L;


    /**
     * 图片搜索喜欢key
     */
    String PICTURE_SEARCH_LIKE_KEY = "picture:search:like:";

    /**
     * 图片搜索喜欢key 过期时间
     */
    Integer PICTURE_SEARCH_LIKE_TTL = 5;

    /**
     * 分页查询图片缓存key
     */
    String PICTURE_PAGE_KEY = "picture:page:";
    /**
     * 分页查询图片缓存key 过期时间
     */
    Integer PICTURE_PAGE_TTL = 5;


    /**
     * 图片详情缓存key
     */
    String PICTURE_DETAIL_KEY = "picture:detail:";

    /**
     * 图片详情缓存key 过期时间
     */
    Integer PICTURE_DETAIL_TTL = 30;

    /**
     * 分布式锁key 图片
     */
    String PICTURE_LOCK_KEY = "picture:lock:";


    /**
     * BloomFilter
     */
    String BLOOM_FILTER_PICTURE_KEY = "bloom:filter:";

    /**
     * 图片访问量key
     */
    String PICTURE_VIEW_COUNT_KEY = "picture:view:count";


    /**
     * 登录验证码key
     */
    String LOGIN_CODE_KEY = "login:code:";

    /**
     * 验证码限流key
     */
    String LOGIN_CODE_LIMIT_KEY = "login:code:limit:";


    /**
     * lua自增脚本
     */
    String INCR_AND_GET =
            "if redis.call('exists', KEYS[1]) == 1 then " +
                    "  return redis.call('incr', KEYS[1]); " +
                    "else " +
                    "  redis.call('set', KEYS[1], 1); " +
                    "  redis.call('expire', KEYS[1], ARGV[1]); " +
                    "  return 1; " +
                    "end";

    /**
     * 爬虫key
     */
    String SPIDER_KEY = "util:spider:";

}
